package com.example.qxfw.qxybzz.controller;


import com.example.qxfw.common.SysResult;
import com.example.qxfw.qxybzz.service.WarningMediaService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * 气象预警融媒体
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/warningMedia")
public class WarningMediaController {


    private final WarningMediaService warningMediaService;

    /**
     * 模板库展示数据
     */
    @GetMapping("/getWarningMediaName")
    public SysResult getWarningMedia() {
        return SysResult.success(warningMediaService.getWarningMediaName());
    }



    /**
     * 根据图片描述获取图片（根据模版库中的名字获取指定模版指定图片）
     */
    @GetMapping("/getImageByName")
    public ResponseEntity<byte[]> getImageByName(String text) {
        return warningMediaService.getImageByName(text);
    }


    /**
     * 根据实况信息，预报信息，措施建议，图片编号，是否展示等值图，返回图片
     */
    @GetMapping("/getFinallImage")
    public ResponseEntity<byte[]> getFinallImage(@RequestParam("skcontent") String skcontent,
                                                 @RequestParam("ybcontent")String ybcontent,
                                                     @RequestParam("csjycontent")String csjycontent,
                                                 @RequestParam("imageId")String imageId,
                                                 @RequestParam("isShowImage")Integer isShowImage,
                                                 @RequestParam("name")String name) {
        return warningMediaService.getImage2(skcontent, ybcontent, csjycontent, imageId, isShowImage,name);
    }

}
